package mjava.lib;

import java.util.Vector;

public class DARGS {

	private int taille;
	private Vector<DARG> argList;


	public int getTaille() {
		return taille;
	}

	public Vector<DARG> getArgList() {
		return this.argList;
	}

	public DARGS() {
		taille = 0;
		argList = new Vector<DARG>();
	}

	public void addArg(DARG arg) {
		argList.add(arg);
		this.taille += arg.getArgTaille();
	}
	
	public void addArg(DTYPE type, String id) {
		DARG arg = new DARG(type, id);
		argList.add(arg);
		this.taille += arg.getArgTaille();
	}

	public int getArgNumber() {
		return this.argList.size();
	}

	public String[] getArgsTypeNames() {

		String[] argsTypeNamesArray  = null;
		int argsLength = argList.size();

		if(argsLength > 0) {

			argsTypeNamesArray = new String[argsLength];

			DARG arg = null;

			for(int i = 0; i < argsLength; i++) {
				arg = argList.get(i);
				argsTypeNamesArray[i] = arg.getArgType().getName();
			}
		}

		return argsTypeNamesArray;
	}

	public String getArgsTypeNamesString() {

		String parNameStr = "";

		String[] argsTypeNamesArray = this.getArgsTypeNames();

		for(int i = 0; i < argList.size(); i++) {
			parNameStr += "." + argsTypeNamesArray[i];
		}

		return parNameStr;
	}
}
